﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="SetRegEventTime.aspx.cs"
    Inherits="MTRC.ODMS.Web.SOM.Popup.SetRegEventTime"  ValidateRequest="false" %>

<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls"
    TagPrefix="APJ" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <base target="_self" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <link href="../../CSS/common.css" rel="stylesheet" type="text/css" />

    <script language="JavaScript" src="../../Javascript/CommonFunction.js"></script>

    <script language="javascript">
    
    var pageID;
    
    
    function SaveCheck(strWarnMess, amendTimesReachMaximumTimesMsg)
    {
        if (document.getElementById("hdnIsReachMaxAmendTimes").value == 'Y' && document.getElementById("chkEventTime").checked)
        {
            window.alert(amendTimesReachMaximumTimesMsg);
            return false;
        }
        
        var arrivalDate;
        var arrivalTime;
        var amendReason;
        
        arrivalDate=document.getElementById("dtbArrivalStationTime$dateTextBox").value;
        arrivalTime=document.getElementById("dtbArrivalStationTime$timedateTextBox").value;
        amendReason=document.getElementById("txtAmendReason").value;

        //Comment by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
//        if(trim(arrivalDate)=="" || trim(arrivalTime)=="" || trim(amendReason)=="")
//        {
//            alert(strWarnMess);
//            return false;
        //        }
        //Comment end by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted

        //add by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
        if (getQueryString("ReadOnly").toLowerCase() == "true" && getQueryString("EventStatusID") == "2" && getQueryString("FunctionItemReadOnly") == "0") {
            var chkDCheck = "0";
            var chkECheck = "0";
            
            if (document.getElementById("chkEventTime").checked) {
                chkECheck = "1";
                if (trim(arrivalDate) == "" || trim(arrivalTime) == "") {
                    alert('<%=this.GetMessage("SOM_Amend_EventTime") %>');
                    return false;
                }
            }

            if (document.getElementById("chkDescription").checked) {
                chkDCheck = "1";
                if (trim(document.getElementById("txtAmendDescription").value) == "") {
                    alert('<%=this.GetMessage("SOM_Amend_Description") %>');
                    return false;
                }
            }

            if (chkDCheck == "0" && chkECheck == "0") {
                alert('<%=this.GetMessage("SOM_Amend_EventTime_Description") %>');
                return false;
            }

            if (trim(amendReason) == "") {
                alert('<%=this.GetMessage("SOM_Amend_Reason") %>');
                return false;
            }
        } else {
            if (trim(arrivalDate) == "" || trim(arrivalTime) == "" || trim(amendReason) == "") {
                alert(strWarnMess);
                return false;
            }
        }
        //add end by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
    }


    //---------------Modify by zengshunbo at 2008-12-23 ----------------------
    
//    function btnSaveReturnClick(strWarnMess, amendTimesReachMaximumTimesMsg)
    function btnSaveReturnClick()
    {
        //--//huangyao 20081025 --add function to control maximum amend times
//        if(document.getElementById("hdnIsReachMaxAmendTimes").value == 'Y')
//        {
//            window.alert(amendTimesReachMaximumTimesMsg);
//            return;
//        }
        //-----------end--------------------------------------------------------
        
        ///debugger;
        var arrivalDate;
        var arrivalTime;
        var amendReason;
        
        arrivalDate=document.getElementById("dtbArrivalStationTime$dateTextBox").value;
        arrivalTime=document.getElementById("dtbArrivalStationTime$timedateTextBox").value;
        amendReason=document.getElementById("txtAmendReason").value;
        
        pageID=getQueryString("PageID");
        
       
//        if(trim(arrivalDate)=="" || trim(arrivalTime)=="" || trim(amendReason)=="")
//        {
//            alert(strWarnMess);
//            return false;
//        }
            
        
        if(pageID=="COM" || pageID=="DutySCEntry")
        {
        
//            if(trim(arrivalDate)=="" || trim(arrivalTime)=="" || trim(amendReason)=="")
//            {
//                alert(strWarnMess);
//                return false;
//            }
                        
            dialogArguments.document.getElementById("txtRegDate").value=arrivalDate;
            dialogArguments.document.getElementById("txtRegTime").value=arrivalTime;
            dialogArguments.document.getElementById("txtHideRegDate").value=arrivalDate;
            dialogArguments.document.getElementById("txtHideRegTime").value=arrivalTime;
            dialogArguments.document.getElementById("txtHideReason").value=amendReason;
            window.close();
        }
        else if(pageID=="AL")
        {
//            if(trim(arrivalDate)=="" || trim(arrivalTime)=="" || trim(amendReason)=="")
//            {
//                alert(strWarnMess);
//                return false;
//            }
            dialogArguments.document.getElementById("ucAssetLoan_lblAssetLoanEventTimeVal").innerHTML=arrivalDate + " " + arrivalTime;
            dialogArguments.document.getElementById("ucAssetLoan_hdnAmendTimeVal").value=arrivalDate + " " + arrivalTime;
            dialogArguments.document.getElementById("ucAssetLoan_hdnAmendTimeReason").value=amendReason;
            window.close();
        }
        else if(pageID=="AREntryArrival")
        {
//            if(trim(arrivalDate)=="" || trim(arrivalTime)=="" || trim(amendReason)=="")
//            {
//                alert(strWarnMess);
//                return false;
//            }
            dialogArguments.document.getElementById("hdnArrivalDate").value=arrivalDate; 
            dialogArguments.document.getElementById("hdnArrivalTime").value=arrivalTime; 
            dialogArguments.document.getElementById("hdnChangeArrivalReason").value=amendReason;
            dialogArguments.document.getElementById("hdnAmendTimeVal").value=arrivalDate + " " + arrivalTime;
            window.returnValue='1'
            window.close();
        }
        
        else if(pageID=="AREntryDepart")
        {
//            if(trim(arrivalDate)=="" || trim(arrivalTime)=="" || trim(amendReason)=="")
//            {
//                alert(strWarnMess);
//                return false;
//            }
            dialogArguments.document.getElementById("hdnDepartDate").value=arrivalDate; 
            dialogArguments.document.getElementById("hdnDepartTime").value=arrivalTime; 
            dialogArguments.document.getElementById("lblDepartureTime").value=arrivalDate + " " + arrivalTime;
            dialogArguments.document.getElementById("hdnChangeDepartReason").value=amendReason;
            window.close();
        }
        else if(pageID=="FireProtectionEntry")//---------------Add by Zeng shunbo-----------------------
        {            
            dialogArguments.document.getElementById("UCFirePortection1_txtIsolationDateTime").value=arrivalDate + " " + arrivalTime;;
            dialogArguments.document.getElementById("UCFirePortection1$hdnDateTimeReason").value=amendReason;
            window.close();          
        }
        else if(pageID=="PopupBookOff")  //  Added By Ningheming
        {
//           if(trim(arrivalDate)=="" || trim(arrivalTime)=="" || trim(amendReason)=="")
//            {
//                alert(strWarnMess);
//                return false;
//            }
           document.getElementById ("HistoryRecord").style.display ="none";
           dialogArguments.document.getElementById("txtStationDepartTime").innerHTML=arrivalDate;
           dialogArguments.document.getElementById("lblAmendTime").innerHTML=arrivalTime;
           dialogArguments.document.getElementById("lblHideReason").innerHTML=amendReason;
           dialogArguments.document.getElementById("hdDepartDate").value=arrivalDate;
           dialogArguments.document.getElementById("hdDepartTime").value=arrivalTime;
           dialogArguments.document.getElementById("hdAmendReason").value=amendReason;
           window.close();
        }
        else if (pageID="GeneralEventEntry")
        {
//            if(trim(arrivalDate)=="" || trim(arrivalTime)=="" || trim(amendReason)=="")
//            {
//                alert(strWarnMess);
//                return false;
            //            }
            //Comment by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
            //update by benson 2015-10-26 u253 begin
//            dialogArguments.document.getElementById("hfRegDate").value = arrivalDate;
//            dialogArguments.document.getElementById("hfRegTime").value = arrivalTime;
//            dialogArguments.document.getElementById("lblRegTime").innerHTML = arrivalDate + " " + arrivalTime;
//            dialogArguments.document.getElementById("hdnRegTimeVal").value = arrivalDate + " " + arrivalTime;
//            dialogArguments.document.getElementById("hdnAmendTimeVal").value = arrivalDate + " " + arrivalTime;
            //update by benson 2015-10-26 u253 end
            //Comment end by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
            dialogArguments.document.getElementById("hdnReason").value = amendReason;
            //Comment by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
            //add by gordon 20150814 U138
            //dialogArguments.document.getElementById("lblEstimateCompletionDateTimeVal").innerText = document.getElementById("hdnGenD").value;
            //Comment end by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted

            //add by gordon 20160225 - GE Allow user to amend the description even if the event has been compelted
            if (getQueryString("ReadOnly").toLowerCase() == "true" && getQueryString("EventStatusID") == "2" && getQueryString("FunctionItemReadOnly") == "0") {
                if (document.getElementById("chkDescription").checked) {
                    dialogArguments.document.getElementById("txtDesc").value = document.getElementById("txtAmendDescription").value;
                    //hdnIsAmendDescription
                    dialogArguments.document.getElementById("hdnAmendDescription").value = document.getElementById("txtAmendDescription").value;
                    dialogArguments.document.getElementById("hdnIsAmendDescription").value = "1";
                    window.returnValue = '2'
                } else {
                    dialogArguments.document.getElementById("hdnIsAmendDescription").value = "0";
                }

                if (document.getElementById("chkEventTime").checked) {
                    dialogArguments.document.getElementById("hdnIsAmendTime").value = "1";
                    dialogArguments.document.getElementById("hfRegDate").value = arrivalDate;
                    dialogArguments.document.getElementById("hfRegTime").value = arrivalTime;
                    dialogArguments.document.getElementById("lblRegTime").innerHTML = arrivalDate + " " + arrivalTime;
                    dialogArguments.document.getElementById("hdnRegTimeVal").value = arrivalDate + " " + arrivalTime;
                    dialogArguments.document.getElementById("hdnAmendTimeVal").value = arrivalDate + " " + arrivalTime;
                    dialogArguments.document.getElementById("lblEstimateCompletionDateTimeVal").innerText = document.getElementById("hdnGenD").value;
                    window.returnValue = '2'
                } else {
                    dialogArguments.document.getElementById("hdnIsAmendTime").value = "0";
                }
            } else {
                dialogArguments.document.getElementById("hdnIsAmendTime").value = "1";
                dialogArguments.document.getElementById("hfRegDate").value = arrivalDate;
                dialogArguments.document.getElementById("hfRegTime").value = arrivalTime;
                dialogArguments.document.getElementById("lblRegTime").innerHTML = arrivalDate + " " + arrivalTime;
                dialogArguments.document.getElementById("hdnRegTimeVal").value = arrivalDate + " " + arrivalTime;
                dialogArguments.document.getElementById("hdnAmendTimeVal").value = arrivalDate + " " + arrivalTime;
                dialogArguments.document.getElementById("lblEstimateCompletionDateTimeVal").innerText = document.getElementById("hdnGenD").value;
                window.returnValue = '1'
            }
            //add end by gordon 20160225 - GE Allow user to amend the description even if the event has been compelted

            //window.returnValue = '1'//Comment by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
            window.close();
        }

         return true;
    }
    
    function ShowDetails(clientID)
    {
        window.showModalDialog("ShowDetails.aspx?PageID=COM&ID="+clientID.id,window,"dialogHeight:550px;dialogWidth:700px,center:yes,resizable:no,scroll:no,status:no");
        return false;
    }
    
    function Init()
    {
        //debugger;
    
        var arrivalDate;
        var arrivalTime;
        var amendReason;
        pageID=getQueryString("PageID");
        var readOnly;
        var stationEventID;
        stationEventID=getQueryString("StationEventID");
        readOnly = getQueryString("ReadOnly");
        var eventStatusID = getQueryString("EventStatusID"); //add by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
        var funcItemReadOnly = getQueryString("FunctionItemReadOnly"); //add by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted
        
        if(pageID=="PopupBookOff")
          {
              document.getElementById ("HistoryRecord").style.display ="none";
          }
 
        if(readOnly.toLowerCase()=="false")
        {
          
            if(pageID=="COM" || pageID=="DutySCEntry" || pageID=="AL" || pageID=="AREntryDepart"||pageID=="PopupBookOff" || pageID=="AREntryArrival")
            {
                if(pageID=="DutySCEntry") {
                    arrivalDate=dialogArguments.document.getElementById("txtRegDate").value;      
                    arrivalTime=dialogArguments.document.getElementById("txtRegTime").value;
                    amendReason=dialogArguments.document.getElementById("txtHideReason").value;
                }
                else if(pageID=="AL") {
                    //--added by huangyao 20080909
                    arrivalDate = "";
                    arrivalTime = "";
                    amendReason = "";
                    
                    var tempStr = "";
                    tempStr = dialogArguments.document.getElementById("ucAssetLoan_hdnAmendTimeVal").value;

                    if (tempStr != "") {
                        //alert(dialogArguments.document.getElementById("hdnAmendTimeVal").value);
                        //var d_Date= new Date(dialogArguments.document.getElementById("hdnAmendTimeVal").value);
                        //alert(d_Date)
                        //arrivalDate = d_Date.getDate();
                        //alert(arrivalDate);
                        //arrivalTime=d_Date.getTime();
                        //alert(arrivalTime);
                        var spaceIndex = tempStr.indexOf(" ");
                        arrivalDate = tempStr.substring(0, spaceIndex);
                        arrivalTime = tempStr.substring(spaceIndex + 1, tempStr.length);
                        //modify by tim 20160407 dtbArrivalStationTime
                        document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
                        document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;

                        //end modify
                        amendReason = dialogArguments.document.getElementById("ucAssetLoan_hdnAmendTimeReason").value;
                    }
                    //modify by tim 20160407 dtbArrivalStationTime
                    else {
                        var tempStr = dialogArguments.document.getElementById("ucAssetLoan_hdnInitialEventTime").value;
                        arrivalDate = tempStr.substring(0, 10);
                        arrivalTime = tempStr.substring(18, 11);
                        document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
                        document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;
                    }
                    //end modify
                   }
                   else if(pageID=="PopupBookOff")
                    {
                          arrivalDate=dialogArguments.document.getElementById("txtStationDepartTime").innerHTML;      
                          arrivalTime=dialogArguments.document.getElementById("lblAmendTime").innerHTML;
                          amendReason=dialogArguments.document.getElementById("lblHideReason").innerHTML;
                          document.getElementById ("HistoryRecord").style.display ="none";
                        
                    }
                    else if (pageID=="AREntryArrival")
                    {
                        arrivalDate=dialogArguments.document.getElementById("hdnArrivalDate").value;      
                        arrivalTime=dialogArguments.document.getElementById("hdnArrivalTime").value;
                        amendReason = dialogArguments.document.getElementById("hdnChangeArrivalReason").value;
                        //modify by tim 20160407 dtbArrivalStationTime
                        document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
                        document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;

                        //end modify


                    }
    
                
                if(amendReason!="")
                {
                    document.getElementById("dtbArrivalStationTime$dateTextBox").value=arrivalDate;
                    document.getElementById("dtbArrivalStationTime$timedateTextBox").value=arrivalTime;
                    document.getElementById("txtAmendReason").value=amendReason;
                }
                

            }
            else if(pageID=="FireProtectionEntry")//Add by Zeng shunbo
            {
               
                var temp = dialogArguments.document.getElementById("UCFirePortection1_txtIsolationDateTime").value;
                    arrivalDate=temp.substring(0,10);
                    arrivalTime=temp.substring(18,11);
                    amendReason=dialogArguments.document.getElementById("UCFirePortection1$hdnDateTimeReason").value;
                    //modify by tim 20160407 dtbArrivalStationTime
                    document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
                    document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;

                    //end modify
                                 
                    if(amendReason!="")
                    {                        
                        document.getElementById("dtbArrivalStationTime$dateTextBox").value=arrivalDate;
                        document.getElementById("dtbArrivalStationTime$timedateTextBox").value=arrivalTime;
                        document.getElementById("txtAmendReason").value=amendReason;
                    } 
            }
            else if(pageID=="GeneralEventEntry")
            {
                arrivalDate = dialogArguments.document.getElementById("hfRegDate").value;
                arrivalTime = dialogArguments.document.getElementById("hfRegTime").value;
                amendReason = dialogArguments.document.getElementById("hdnReason").value;
                //modify by tim 20160407 dtbArrivalStationTime
                document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
                document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;
               

                //end modify

                if(amendReason!="")
                {                        
                    document.getElementById("dtbArrivalStationTime$dateTextBox").value=arrivalDate;
                    document.getElementById("dtbArrivalStationTime$timedateTextBox").value=arrivalTime;
                    document.getElementById("txtAmendReason").value=amendReason;
                }

                //add by gordon 20150814 U138
                document.getElementById("hdnGenH").value = dialogArguments.document.getElementById("txtEstimateCompletionDateTimeInputHrs").value; 
            }
        }
        else {
            //modify by tim 20160407 dtbArrivalStationTime

           if (pageID == "FireProtectionEntry") {
            var temp = dialogArguments.document.getElementById("UCFirePortection1_txtIsolationDateTime").value;
            arrivalDate = temp.substring(0, 10);
            arrivalTime = temp.substring(18, 11);

            document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
             document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;
         }

         if (pageID == "AL") {

            var tempStr = dialogArguments.document.getElementById("ucAssetLoan_hdnInitialEventTime").value;
            arrivalDate = tempStr.substring(0, 10);
            arrivalTime = tempStr.substring(18, 11);
             document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
             document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;
         }
         if (pageID == "AssetLoanEntry") {
             var temp = dialogArguments.document.getElementById("UCFirePortection1_txtIsolationDateTime").value;
             arrivalDate = temp.substring(0, 10);
             arrivalTime = temp.substring(18, 11);

             document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
             document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;
         }
          if (pageID == "AREntryArrival") {
             arrivalDate = dialogArguments.document.getElementById("hdnArrivalDate").value;
             arrivalTime = dialogArguments.document.getElementById("hdnArrivalTime").value;
             amendReason = dialogArguments.document.getElementById("hdnChangeArrivalReason").value;
            
             document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
             document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;

            


         }
         
            //end modify

             document.getElementById("btnSaveReturn").disabled=true;
             //document.getElementById("btnSaveReturn").disabled=false;

             //add by gordon 20160225 - GE Allow user to amend the description even if the event has been compelted
             if (pageID == "GeneralEventEntry" && eventStatusID == "2") {
              
                 document.getElementById("chkEventTime").checked = false;
                 if (funcItemReadOnly == "0") {
                     document.getElementById("btnSaveReturn").disabled = false;
                 }
                 document.getElementById("trGEDescription").style.display = "block";
                 document.getElementById("chkEventTime").style.visibility = "visible";
                 document.getElementById("dtbArrivalStationTime$dateTextBox").disabled = true;
                 document.getElementById("dtbArrivalStationTime$timedateTextBox").disabled = true;
                 document.getElementById("dtbArrivalStationTime_dtbArrivalStationTime_img").disabled = true;

                 arrivalDate = dialogArguments.document.getElementById("hfRegDate").value;
                 arrivalTime = dialogArguments.document.getElementById("hfRegTime").value;
                 amendReason = dialogArguments.document.getElementById("hdnReason").value;

                 //modify by tim 20160407 for SIT20
                 document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
                 document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;
                 document.getElementById("txtEventTimeDateBefore").value = arrivalDate;
                 document.getElementById("txtEventTimeTimeBefore").value = arrivalTime;
                 //end modify

                 var desc = dialogArguments.document.getElementById("txtDesc").value;
                 var isAmend = dialogArguments.document.getElementById("hdnIsAmendTime").value;
                 if (amendReason != "") {
                     if (arrivalDate != "" && arrivalTime != "" && isAmend == "1") {
                         document.getElementById("chkEventTime").checked = true;
                         document.getElementById("dtbArrivalStationTime$dateTextBox").disabled = false;
                         document.getElementById("dtbArrivalStationTime$timedateTextBox").disabled = false;
                         document.getElementById("dtbArrivalStationTime_dtbArrivalStationTime_img").disabled = false;
                         document.getElementById("dtbArrivalStationTime$dateTextBox").value = arrivalDate;
                         document.getElementById("dtbArrivalStationTime$timedateTextBox").value = arrivalTime;
                       
                     }

                     document.getElementById("txtAmendReason").value = amendReason;
                     if (dialogArguments.document.getElementById("hdnIsAmendDescription").value == "1") {
                         document.getElementById("chkDescription").checked = true;
                         document.getElementById("txtAmendDescription").disabled = false;
                         document.getElementById("txtAmendDescription").value = desc;
                     }
                    
                    
                 }

                 if (desc != "" && amendReason == "") {
                     document.getElementById("txtAmendDescription").value = desc;
                     document.getElementById("txtDescriptionBefore").value = desc;   //add by tim 20160516 for SIT20
                 }

                 document.getElementById("hdnGenH").value = dialogArguments.document.getElementById("txtEstimateCompletionDateTimeInputHrs").value;
             }
             //add end by gordon 20160225 - GE Allow user to amend the description even if the event has been compelted
        }
    }

    //add by gordon 20160225 - GE Allow user to amend the description even if the event has been compelted
    function ChkEventTime_CheckedChanged() {
        var checked = document.getElementById("chkEventTime").checked;
        document.getElementById("dtbArrivalStationTime$dateTextBox").disabled = !checked;
        document.getElementById("dtbArrivalStationTime$timedateTextBox").disabled = !checked;
        document.getElementById("dtbArrivalStationTime_dtbArrivalStationTime_img").disabled = !checked;
    }

    function ChkDescription_CheckedChanged() {
        var checked = document.getElementById("chkDescription").checked;
        document.getElementById("txtAmendDescription").disabled = !checked;
    }
    //add end by gordon 20160225 - GE Allow user to amend the description even if the event has been compelted
   
    </script>

</head>
<body onload="Init();" style="margin-top: 5px; padding-left: 0px; margin-left: 10px;
    padding-top: 0px; padding-right: 0px; margin-right: 10px; width: 95%; height: 100%">
    <form id="form2" runat="server" style="height: 100%">
        <%-- add by gordon 20150814 U138 --%>
        <asp:HiddenField ID="hdnGenH" runat="server" />
        <asp:HiddenField ID="hdnGenD" runat="server" />
        <div>
            <%--<table width="100%" border="1">
                <tr>
                    <td style="width: 15%">
                        <asp:Label ID="lblArrivalStationTime" runat="server" Text="Arrive Station Time"></asp:Label>
                        <asp:Label ID="Label1" runat="server" ForeColor="Red" Text="*" Width="4px"></asp:Label></td>
                    <td align="left">
                        <APJ:DateTextBox ID="dtbArrivalStationTime" runat="server" HasTime="true" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 15%" valign="top">
                        <asp:Label ID="lblAmendReason" runat="server" Text="Amend Reason"></asp:Label>
                        <asp:Label ID="Label2" runat="server" ForeColor="Red" Text="*" Width="4px"></asp:Label></td>
                    <td align="left">
                        <asp:TextBox ID="txtAmendReason" runat="server" Height="88px" TextMode="MultiLine"
                            Width="99%"></asp:TextBox></td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        <INPUT type="hidden" id="hdnIsReachMaxAmendTimes" name="hdnIsReachMaxAmendTimes" runat="server">
                        <asp:Button ID="btnSaveReturn" runat="server" Text="Save&Return" OnClick="btnSaveReturn_Click" />
                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                    </td>
                </tr>
            </table>--%>
            <table style="width:810px">
                <tr>
                    <td style="width:20px;"><input type="checkbox" id="chkEventTime" onclick="ChkEventTime_CheckedChanged();" checked="true" style="visibility:hidden" runat="server"  /></td>
                    <td style="width: 130px;">
                        <asp:Label ID="lblArrivalStationTime" runat="server" Text="Arrive Station Time"></asp:Label>
                        <asp:Label ID="Label1" runat="server" ForeColor="Red" Text="*" Width="4px"></asp:Label></td>
                    <td align="left">
                        <APJ:DateTextBox ID="dtbArrivalStationTime" runat="server" HasTime="true" />
                    </td>
                </tr>
                <tr id="trGEDescription" style="display:none">
                    <td valign="top"  style="width:20px;"><input type="checkbox" id="chkDescription" onclick="ChkDescription_CheckedChanged();" runat="server" /></td>
                    <td style="width: 130px;" valign="top">
                        <asp:Label ID="lblAmendDescription" runat="server" Text="Description"></asp:Label>
                        <asp:Label ID="Label4" runat="server" ForeColor="Red" Text="*" Width="4px"></asp:Label></td>
                    <td align="left" style="width: 83%">
                        <asp:TextBox ID="txtAmendDescription" runat="server" Height="88px"  
                            Enabled="false" TextMode="MultiLine" Width="658px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td style="width: 130px;" valign="top">
                        <asp:Label ID="lblAmendReason" runat="server" Text="Amend Reason"></asp:Label>
                        <asp:Label ID="Label2" runat="server" ForeColor="Red" Text="*" Width="4px"></asp:Label></td>
                    <td align="left">
                        <asp:TextBox ID="txtAmendReason" runat="server" Height="88px" TextMode="MultiLine" Width="658px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td colspan="2" align="right">
                        <INPUT type="hidden" id="hdnIsReachMaxAmendTimes" name="hdnIsReachMaxAmendTimes" runat="server">
                        <asp:Button ID="btnSaveReturn" runat="server" Text="Save&Return" OnClick="btnSaveReturn_Click" />
                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                    </td>
                </tr>
            </table>
            <div id="HistoryRecord" runat ="server"  style=" margin-left:20px; height: 250px; width: 99%; overflow: auto; border-style: groove;">
            
            
            <table width="100%">
                <tr>
                    <td colspan="2">
                        <fieldset>
                            <legend>
                                <asp:Label ID="lblHistory" runat="server" Text="Historical Amendments"></asp:Label></legend>
                                <br />
                            <APJ:CommonGridView ID="grdAmendReason" runat="server" AllowPaging="True" AllowSorting="True"
                                AscPic="~/Images/Common/arrow_up_green.png" AutoGenerateColumns="False" BorderColor="black"
                                CssClass="GridView" DescPic="~/Images/Common/arrow_down_green.png" EnableTheming="True"
                                OnRowDataBound="grdAmendReason_RowDataBound" Width="100%" OnNeedDataBind="grdAmendReason_NeedDataBind" PageLinkCount="7">
                                <Columns>
                                     <%--  update by gordon 20160226 - GE Allow user to amend the description even if the event has been compelted --%>
                                    <%--<asp:TemplateField HeaderText="SOM_OriginalEventTime" SortExpression="OriginalEventTime">--%>
                                    <asp:TemplateField HeaderText="SOM_Amend_EventTime" SortExpression="OriginalEventTime">
                                        <edititemtemplate>
<asp:TextBox id="TextBox1" runat="server" Text='<%# Bind("OriginalEventTime") %>' __designer:wfdid="w2"></asp:TextBox>
</edititemtemplate>
                                        <itemtemplate>
<asp:Label id="lblEventTime"  runat="server" Text='<%# FormatDateTime(Eval("OriginalEventTime"),true) %>' __designer:wfdid="w1"></asp:Label>
</itemtemplate>
                                        <ItemStyle Width="66px" />
                                    </asp:TemplateField>
                                    <%--  add by gordon 20160225 - GE Allow user to amend the description even if the event has been compelted --%>
                                    <asp:TemplateField HeaderText="SOM_Amend_Description" Visible="false" SortExpression="OriginalDescription">
                                        <itemtemplate>
                                         <asp:Label id="lblDescription" runat="server" Text='<%# Bind("OriginalDescription") %>'></asp:Label>
                                         <DIV style="DISPLAY:none"><asp:TextBox id="txtDescriptionValue" runat="server" Text='<%# Bind("OriginalDescription") %>' TextMode="MultiLine"></asp:TextBox></DIV>
                                        <%-- <asp:Button id="btnShowDescription" runat="server" Text="..." ></asp:Button> --%>
                                         <asp:ImageButton ID="btnShowDescription" runat="server" ImageUrl="~/Images/Common/view.png"   />
                                        </itemtemplate>
                                        <ItemStyle Width="280PX" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="SOM_OriginalEventTime" SortExpression="LastUpdTime" >
                                        <itemtemplate>
                                         <asp:Label id="lblAmendTime" runat="server" Text='<%# FormatDateTime(Eval("LastUpdTime"),true) %>'></asp:Label>
                                        </itemtemplate>
                                         <ItemStyle Width="75px" />
                                    </asp:TemplateField>
                                    <%--  add end by gordon 20160225 - GE Allow user to amend the description even if the event has been compelted --%>

                                    <asp:TemplateField HeaderText="SOM_AmendUser" SortExpression="AmendUser">
                                     <itemtemplate>
                                         <asp:Label id="lblUserID" runat="server" Text='<%# Bind("AmendUser") %>'></asp:Label>
                                        </itemtemplate>
                                      <ItemStyle Width="70px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="SOM_AmendReason" SortExpression="Reason">
                                        <itemtemplate>
<asp:Label id="lblReasonShowShort" runat="server" Text='<%# Bind("Reason") %>' __designer:wfdid="w8"></asp:Label> <DIV style="DISPLAY:none"><asp:TextBox id="txtReasonValue" runat="server" Text='<%# Bind("Reason") %>' TextMode="MultiLine" __designer:wfdid="w5"></asp:TextBox></DIV>
</itemtemplate> <ItemStyle Width="210px" />
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <itemtemplate>
<%--<asp:Button id="btnShowDetails" runat="server" Text="..."  __designer:wfdid="w4"></asp:Button> --%>
 <asp:ImageButton ID="btnShowDetails" runat="server" ImageUrl="~/Images/Common/view.png"   />
</itemtemplate>
<ItemStyle Width="17px" />
                                    </asp:TemplateField>
                                </Columns>
                                <PagerTemplate>
                                    <asp:Table ID="CommonPagerTemplate" runat="server" Width="100%">
                                        <asp:TableRow ID="COMGRIDV_TR" runat="server">
                                            <asp:TableCell ID="COMGRIDV_Pager_Cell_TotalRecords" runat="server" CssClass="GridView_Pager_Cell_TotalRecords">
                                                <asp:Label ID="Lbl_T_TotalRecords" runat="server">Total Records:</asp:Label>
                                                <asp:Label ID="Lbl_V_TotalRecords" runat="server"></asp:Label>
                                                &nbsp; &nbsp;
                                                <asp:Label ID="Lbl_V_CurPage" runat="server"></asp:Label>
                                                &nbsp;<asp:Label runat="server">/</asp:Label>
                                                &nbsp;<asp:Label ID="Lbl_V_TotalPages" runat="server"></asp:Label>
                                            </asp:TableCell>
                                            <asp:TableCell ID="COMGRIDV_Pager_Cell_PageSize" runat="server" CssClass="GridView_Pager_Cell_PageSize">
                                                <asp:Label ID="Lbl_T_PageSize" runat="server">PageSize:</asp:Label>
                                                &nbsp;&nbsp;<asp:DropDownList ID="DDL_PageSize" runat="server" AutoPostBack="True">
                                                    <asp:ListItem Value="5">5</asp:ListItem>
                                                    <asp:ListItem Value="10">10</asp:ListItem>
                                                    <asp:ListItem Value="15">15</asp:ListItem>
                                                    <asp:ListItem Value="20">20</asp:ListItem>
                                                    <asp:ListItem Value="25">25</asp:ListItem>
                                                    <asp:ListItem Value="30">30</asp:ListItem>
                                                </asp:DropDownList>
                                            </asp:TableCell>
                                            <asp:TableCell ID="COMGRIDV_Pager_Cell_Prev" runat="server" CssClass="GridView_Pager_Cell_Prev">
                                                <asp:LinkButton ID="LBtn_Previous" runat="server" CommandArgument="Prev" CommandName="Page"><</asp:LinkButton>
                                            </asp:TableCell>
                                            <asp:TableCell ID="COMGRIDV_Pager_Cell_PagerLink" runat="server" CssClass="GridView_Pager_Cell_PagerLink">
                                                <asp:Panel ID="Pnl_PageLink" runat="server" CssClass="GridView_Pager_PageLinkPanel">
                                                </asp:Panel>
                                            </asp:TableCell>
                                            <asp:TableCell ID="COMGRIDV_Pager_Cell_Next" runat="server" CssClass="GridView_Pager_Cell_Next">
                                                <asp:LinkButton ID="LBtn_Next" runat="server" CommandArgument="Next" CommandName="Page">></asp:LinkButton>
                                            </asp:TableCell>
                                        </asp:TableRow>
                                    </asp:Table>
                                </PagerTemplate>
                                <RowStyle CssClass="GridView_Row" />
                                <HeaderStyle CssClass="GridView_Header" />
                                <AlternatingRowStyle CssClass="GridView_AlternativeRow" />
                                <EmptyDataRowStyle CssClass="GridView_Header" />
                                <EmptyDataTemplate>
                                    <asp:Table runat="server" CssClass="GridView_Header_EmptyData">
                                        <asp:TableRow runat="server">
                                            <asp:TableCell runat="server" Style="border-right: black 1px solid;"></asp:TableCell>
                                            <asp:TableCell runat="server" Style="border-right: black 1px solid;"></asp:TableCell>
                                            <asp:TableCell runat="server"></asp:TableCell>
                                        </asp:TableRow>
                                    </asp:Table>
                                </EmptyDataTemplate>
                            </APJ:CommonGridView>
                        </fieldset>
                    </td>
                </tr>
            </table>
            <asp:HiddenField id="txtDescriptionBefore" runat="server" />
            <asp:HiddenField id="txtEventTimeDateBefore" runat="server" />
            <asp:HiddenField id="txtEventTimeTimeBefore" runat="server" />
            </div>
        </div>
        <br />
        <br />
    </form>
</body>
</html>
